import {request} from "../request.js"

export function getGameList(data) {
	return request({
		url: "/api-member/umsgame/notAuth/list",
		needAuth: false,
		data
	})
}

export function initiateGame(storeId, gameId, mode, count) {
	return request({
		url: "/api-member/umsgameactivegame/app/initiateGame",
		method: "post",
		data: {storeId, gameId, mode, count}
	})
}

export function getMyActiveGame() {
	return request({
		url: "/api-member/umsgameactivegame/app/getActiveGameByMember",
		showLoading: false
	})
}

export function joinGame(activeGameId) {
	return request({
		url: "/api-member/umsgameactivegame/app/joinGame",
		data: {activeGameId}
	})
}

export function quickJoin(storeId) {
	return request({
		url: "/api-member/umsgameactivegame/app/quickJoin",
		data: {storeId}
	})
}

export function getActiveGameList(data) {
	return request({
		url: "/api-member/umsgameactivegame/notAuth/getActiveGameList",
		needAuth: false,
		showLoading: false,
		data
	})
}

export function queryStatus(ids) {
	return request({
		url: "/api-member/umsgameactivegame/notAuth/queryStatus",
		method: "post",
		needAuth: false,
		data: ids
	})
}

export function getMyCharacter() {
	return request({
		url: "/api-member/umsgamecharacter/getMyCharacter"
	})
}

export function saveCharacter(data) {
	return request({
		url: "/api-member/umsgamecharacter/save",
		method: "post",
		data
	})
}

export function quitGame() {
	return request({
		url: "/api-member/umsgameactivegame/quitGame",
	})
}

// 查询是否有可用的设施
export function facilityAvailable(storeId, gameId, peopleCount) {
	return request({
		url: "/api-member/umsgamefacility/notAuth/hasFreeForGame",
		needAuth: false,
		data: {
			gameId: gameId,
			storeId: storeId,
			peopleCount: peopleCount
		}
	})
}

export function facilityAvailableList(data) {
	return request({
		url: "/api-member/umsgamefacility/notAuth/hasFreeForGames",
		needAuth: false,
		method: "post",
		data
	})
}
